package com.github.baichuan.gb32960.codec;

import com.github.baichuan.iot.protocol.pdu.Decoder;
import com.github.baichuan.iot.protocol.utils.DateTimeCodec;
import io.netty.buffer.ByteBuf;

import java.util.*;

/**
 * 车辆登出
 */
public class Cmd04 implements Decoder {
    @Override
    public List<Map<String, Object>> decode(ByteBuf buf) {
        Map<String, Object> data = new TreeMap<>();

        // 登出时间
        data.put("timestamp", DateTimeCodec.decode(buf));
        // 登录流水号
        data.put("serialNo", buf.readUnsignedShort());

        return Arrays.asList(data);
    }
}
